from django_filters import rest_framework as filters
from .models import *

class VideosFilter(filters.FilterSet):
    #根据名称进行模糊匹配
    name=filters.CharFilter(field_name='name',lookup_expr='icontains')
    #价格区间
    user_id=filters.NumberFilter(field_name='user_id')

    class Meta:
        model=Video_web1
        fields=('name','user_id')
class VideosCategoryFilter(filters.FilterSet):
    #根据名称进行模糊匹配
    name=filters.CharFilter(field_name='name',lookup_expr='icontains')
    #价格区间
    id=filters.NumberFilter(field_name='id')
    parent=filters.CharFilter(field_name='parent')
    class Meta:
        model=VideosCategory
        fields=('name','id','parent')